package com.sky.controller.user;

import com.sky.entity.Dish;
import com.sky.result.Result;
import com.sky.service.DishService;
import com.sky.vo.DishVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * @Author 梁科
 * @Version 1.0
 * @ Date 2025/10/26 21:59
 */
@RestController(value = "userDishController")
@RequestMapping(value = "/user/dish")
@Api(tags = "用户端菜品相关接口")
@Slf4j
public class DishController {
    @Resource
    DishService dishService;

    /**
     * 根据分类id查找菜品和对应口味
     * @param categoryId
     * @return
     */
    @ApiOperation(value = "根据分类id查找菜品和对应口味")
    @GetMapping(value = "/list")
    public Result<List<DishVO>> list(Long categoryId) {
        List<DishVO> dishVOS = dishService.getDishWithFlavorByCategoryId(categoryId);
        return Result.success(dishVOS);
    }
}
